package com.oktest.measure.db.room

import androidx.room.*
import com.oktest.measure.entity.Device
import com.oktest.measure.entity.Measure
import com.oktest.measure.entity.Type

/**
 * @Author hhh
 * @Date 2020/10/24
 */

@Dao
interface TypeDao{
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(bean:List<Type>)

    @Query("select * from type")
    fun queryAll(): List<Type>

    @Query("select * from measure where typeId=:id")
    fun measures(id: Long): List<Measure>

    @Query("select * from device where xmlId=:id")
    fun getDevice(id: Long): Device

    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(type: Type)

    @Query("select * from type where id=:id")
    fun load(id: Long): Type?
}